package com.mdp.workflow.pub.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mdp.workflow.pub.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
@DS("adm-ds")
@Transactional(propagation = Propagation.REQUIRES_NEW)
public interface SysUserMapper extends BaseMapper<SysUser> {
    List<Map<String, Object>> selectMdpUsersByFilter(Map<String, Object> user);

    List<String> selectUsersByGroups(List<String> groups);

    List<Map<String, Object>> selectMdpGroupsByFilter(Map<String, Object> p);

    Map<String, Object> selectUserInfomation(Map<String, Object> sysUser);

    List<Map<String, Object>> selectUserListForSimpleInfoByUserids(List<String> userids);

    List<Map<String, Object>> selectDeptListByDeptids(List<String> userids);

    List<Map<String, Object>> selectUserDeptsByUseridAndDeptidList(List<Map<String, Object>> useridAndDeptidList);

    List<Map<String, Object>> selectPostListByPostIds(List<String> userids);

    /**
     * 自定义查询，支持多表关联
     * @param page 分页条件
     * @param ew 一定要，并且必须加@Param("ew")注解
     * @param ext 如果xml中需要根据某些值进行特殊处理，可以通过这个进行传递，非必须，注解也可以不加
     * @return
     */
    public List<Map<String,Object>> selectListMapByWhere(IPage page, @Param("ew") QueryWrapper ew, @Param("ext") Map<String,Object> ext);

}
